<?php
/**
 * Created by PhpStorm.
 * User: hao
 * Date: 2018/10/24
 * Time: 9:53 AM
 */

namespace app\api\model;


class Banner extends BaseModel
{
    protected $hidden = ['delete_time','update_time'];//隐藏哪些字段
//    protected $visible  //提取那些字段
    public function items(){
        return $this->hasMany('BannerItem','banner_id','id');
    }
    public static function getBannerByID($id) {
        //TODO:根据bannerID获取banner信息
        $banner = self::with(['items.img'])->find($id);

        return $banner;
    }
}